/*
 *  Vector.cpp
 *  zray-gui
 *
 *  Created by czalkin on 1/10/09.
 *  Copyright 2009 __MyCompanyName__. All rights reserved.
 *
 */

#include "Vector3.hpp"

Vector3::Vector3( const Point3 &pt )
{
	v[0] = pt.v[0];
	v[1] = pt.v[1];
	v[2] = pt.v[2];
}

float Vector3::dot( const Point3 &rhs ) const
{
	return v[0]*rhs.v[0] + v[1]*rhs.v[1] + v[2]*rhs.v[2];
}

Vector3 Vector3::reflect( const Vector3 &normal ) const
{
	Vector3 direction_incoming = *this;
	float nDotD = normal.dot( direction_incoming );
	nDotD *= 2.0f;
	Vector3 temp = normal * nDotD;
	Vector3 refl = direction_incoming - temp;
	refl.normalize_inPlace();	
	return refl;
}


